// import Cookies from 'js-cookie'

const TokenKey = 'TrainingToken'
const UserInfo = 'TrainingUserInfo'
const RedirectUri = 'RedirectUri'

// token
export function getToken() {
  return localStorage.getItem(TokenKey)
}

export function setToken(token) {
  return localStorage.setItem(TokenKey, token)
}

export function removeToken() {
  return localStorage.removeItem(TokenKey)
}

// userInfo
export function getUserInfo() {
  return JSON.parse(localStorage.getItem(UserInfo))
}

export function setUserInfo(userInfo) {
  let userInfoStr = JSON.stringify(userInfo)
  return localStorage.setItem(UserInfo, userInfoStr)
}

export function removeUserInfo() {
  return localStorage.removeItem(UserInfo)
}

// redirectUri
export function getRedirectUri() {
  return localStorage.getItem(RedirectUri)
}

export function setRedirectUri(redirectUri) {
  return localStorage.setItem(RedirectUri, redirectUri)
}

export function removeRedirectUri() {
  return localStorage.removeItem(RedirectUri)
}
